package lang;

import org.nutz.lang.Stopwatch;

public class PerformonEfficent {

	Stopwatch stopwatch;
	
	/**
	 * 以指定次数运行测试代码，并记时.
	 * @param callback
	 * @param count
	 */
	public PerformonEfficent(PerfmonCallback callback,int count)
	{
		stopwatch=Stopwatch.begin();
		for (int i = 0; i < count; i++) {
			callback.perfmon();
		}
		stopwatch.stop();
		System.out.println(stopwatch.getDuration());
	}
	
	public String getTime(){
		return stopwatch.toString();
	}
}
